<?php
require_once("db_info.php");

$errmsg_arr = array();

$errflag = false;

$connection = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

if(!$connection)
{
    die("Failed to connect to server: " . mysql_error());
}

// VERRRAH IMPORTANT
mysql_set_charset("utf8", $connection);

$db = mysql_select_db(DB_DATABASE);

if(!$db)
{
    die("Unable to select database");
}

//Function to sanitize values received from the form. Prevents SQL injection
function clean($str)
{
    $str = @trim($str);
    if(get_magic_quotes_gpc())
    {
        $str = stripslashes($str);
    }
    return mysql_real_escape_string($str);
}
?>